<?php

abstract class Quad_View_Abstract extends Quad_MagicProperties implements Quad_View_Interface, Quad_Mvc_Interface {
	
	protected $_controller;
	
	public function __construct(Quad_Controller_Interface $controller) {
		$this->_controller = $controller;
	}
	
	public function getController() {
		return $this->_controller;
	}
	
	public function getFrontController() {
		return $this->getController()->getFrontController();
	}

	public function getBootstrap() {
		return $this->getController()->getBootstrap();
	}

	public function getRouter() {
		return $this->getController()->getRouter();
	}
	
	public function getView() {
		return $this;
	}
	
	public function getUrl() {
		return $this->getController()->getUrl();
	}

	public function getControllerName() {
	  $this->getFrontController()->getControllerName();
	}
	
	public function getActionName() {
		$this->getFrontController()->getActionName();
	}
	  
	public function assign($p, $v) {
		if (is_array($p)) {
			foreach ($p as $p1 => $v1) {
				$this->$p1 = $v1;
			}
    } elseif ($p instanceof Quad_MagicProperties) {
      $this->assign($p->getProperties());			
			
		} elseif (is_object($p)) {
			$this->assign(get_obj_vars($p));
			
		} else {
		  $this->$p = $v;
		}
		return $this;
	}
	
	public function fetch() { return ''; }
	public function render() { return $this; }
  public function setLayoutTplPath() { return $this; }
  public function setContentTplPath() { return $this; }
  public function setLayoutTpl() { return $this; }
  public function setContentTpl() { return $this; }
  public function addHelper() { return $this; }
  public function addHelperPath() { return $this; }
		
}